 import instance from "./utils/http";
/* 轮播图 */
export function getLoop(number) {
    return instance.get(`/api/weChat/applet/course/banner/list?number=${number}`)
}/* 课程列表 */
export function getList(type, pageNum, pageSize){
    let params = new URLSearchParams
    params.append("type", type)
     params.append("pageNum", pageNum)
    params.append("pageSize", pageSize)
    return instance.post(`/api/weChat/applet/course/list/type`, params)
}
/* 分类列表 */
export function getClassifyList(data={}){
    return instance.post(`/api/weChat/applet/subject/list`,data)
}
/* 课程详情 */
export function getCourseDetail(courseId){
    return instance.get(`/api/pc/course/detail/${courseId}`)
}
/* 评论列表 */
export function getComment(courseId){
    return instance.get(`/api/pc/comment/commentList/course/${courseId}`)
}
// 获取搜索结果
export function getSearchResult(pageNum, pageSize, type, subjectId, keyword, form) {
    const url = `/api/pc/course/search/keyword?pageNum=${pageNum}&pageSize=${pageSize}&type=${type}&keyword=${keyword}&subjectId=${subjectId}&courseType=${form}`; 
    return instance.get(url)
}

// 账号密码登录
export function getLoginInfo(username, password) {
    let params = new URLSearchParams
    params.append("username", username)
    params.append("password", password)
    params.append("rememberMe", false)
    return instance.post(`/api/pcUser/login`, params)
}


// 登录时发送手机验证码
export function  getCheckCode(mobile){
    return instance.get(`/api/pcUser/login/send/code/${mobile}`)

}